package montecarlothreads.model;

import java.io.BufferedReader;
import java.io.File;
import java.io.FileReader;
import java.io.IOException;
import java.util.StringTokenizer;
import montecarlothreads.MonteCarloThreads;

//Read a csv file with up to 10 arguments on each line
public class CSV {
    public static String[] price = new String[10];
    public static String[] strikePrice = new String[10];
    public static String[] interestRate = new String[10];
    public static String[] time = new String[10];
    public static String[] detention = new String[10];
    public static String[] volatility = new String[10];
    public static String[] nSteps = new String[10];
    public static String[] nSimulations = new String[10];
    public static void loadFile() throws IOException{

        FileReader file = new FileReader(MonteCarloThreads.path);
                BufferedReader br = new BufferedReader(file);
                    String stringRead = br.readLine();
                        String token;
                        StringTokenizer st = new StringTokenizer(stringRead, ",");
                        for (int i = 0; i< 10; i++){
                            token=st.nextToken();
                        if (!(token.equals(""))) {
                            price[i] = token;
                        }
                        }
                        stringRead = br.readLine();
                        st = new StringTokenizer(stringRead, ",");
                        for (int i = 0; i< 10; i++){
                            token=st.nextToken();
                        if (!(token.equals(""))) {
                            strikePrice[i] = token;
                        }
                        }
                        stringRead = br.readLine();
                        st = new StringTokenizer(stringRead, ",");
                        for (int i = 0; i< 10; i++){
                            token=st.nextToken();
                        if (!(token.equals(""))) {
                            interestRate[i] = token;
                        }
                        }
                        stringRead = br.readLine();
                        st = new StringTokenizer(stringRead, ",");
                        for (int i = 0; i< 10; i++){
                            token=st.nextToken();
                        if (!(token.equals(""))) {
                            time[i] = token;
                        }
                        }
                        stringRead = br.readLine();
                        st = new StringTokenizer(stringRead, ",");
                        for (int i = 0; i< 10; i++){
                            token=st.nextToken();
                        if (!(token.equals(""))) {
                            detention[i] = token;
                        }
                        }
                        stringRead = br.readLine();
                        st = new StringTokenizer(stringRead, ",");
                        for (int i = 0; i< 10; i++){
                            token=st.nextToken();
                        if (!(token.equals(""))) {
                            volatility[i] = token;
                        }
                        }
                        stringRead = br.readLine();
                        st = new StringTokenizer(stringRead, ",");
                        for (int i = 0; i< 10; i++){
                            token=st.nextToken();
                        if (!(token.equals(""))) {
                            nSteps[i] = token;
                        }
                        }
                        stringRead = br.readLine();
                        st = new StringTokenizer(stringRead, ",");
                        for (int i = 0; i< 10; i++){
                            token=st.nextToken();
                        if (!(token.equals(""))) {
                            nSimulations[i] = token;
                        }
                        }}}
        

